package com.skytech.component.crawler.scratch;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.Map;

@Service
public class TaskStatusService {

    @Autowired
    private TaskStatusDAO taskStatusDAO;

    public Map<String,Integer> findAllByStatus() {
        Map<String,Integer> map=new HashMap<>();
        for (State state:State.values()) {

            map.put(state.toString(),taskStatusDAO.findGroupByStatus(state.toString())==null? 0 :taskStatusDAO.findGroupByStatus(state.toString()));
        }
        return  map;

    }
}
